/*
 * @Author: silence silence9685@163.com
 * @Date: 2023-07-20 15:18:39
 * @LastEditors: silence silence9685@163.com
 * @LastEditTime: 2023-07-21 11:52:47
 * @FilePath: \ems_neutral_app\lib\pages\Login\View\LoginRegisterItem.dart
 * @Description: 登录模块-输入item
 */
import 'package:flutter/material.dart';
import 'package:sil_base_widget_package/sil_base_widget_package.dart';

import '../../../common/widgets/cubitWidget/InputView.dart';
import '../../../utils/color/ColorUtils.dart';

class LoginRegisterItem extends StatelessWidget {
  final String? imgPath;
  final String? hintText;
  final InputViewType inputViewType;
  final dynamic Function(bool, String) onValid;
  final  bool showSendCode;
  final String? account;
  final CodeType? codeType;
  const LoginRegisterItem(
      {required this.onValid,
      this.imgPath,
      this.hintText,
      this.inputViewType = InputViewType.InputViewTypeNormal,
      this.codeType = CodeType.CodeTypeByPhone,
      this.showSendCode = false,
      this.account,
      super.key});

  @override
  Widget build(BuildContext context) {
    Widget letfWidget = Row(
      children: [
        SilImage(
          imgPath,
          height: 28.w,
          width: 28.w,
          margin: EdgeInsets.only(right: 8.w),
        ),
        Container(
          height: 28.w,
          width: 0.5.w,
          margin: EdgeInsets.only(top: 3.w, bottom: 3.w, right: 18.w),
          color: ColorUtils.hexColor('#333333'),
        ),
      ],
    );

    return InputView(
        margin: EdgeInsets.only(top: 30.w),
        inputViewMargin: EdgeInsets.symmetric(horizontal: 8.w),
        title: '',
        hintText: hintText,
        inputViewType: inputViewType,
        leftView: letfWidget,
        hideTitle: true,
        account:this.account,
        showSendCode: this.showSendCode,
        codeType: this.codeType,
        showClearBtn: inputViewType != InputViewType.InputViewTypeCode,
        onValid: onValid);
  }
}
